#ifndef LRCWIDGET_H
#define LRCWIDGET_H

#include <QWidget>
#include "songmanager.h"
#include <QVector>
#include <QNetworkAccessManager>
struct LineOfLrc{
    qint64 time;
    QString text;
};

namespace Ui {
class LrcWidget;
}

class LrcWidget : public QWidget
{
    Q_OBJECT

public:
    explicit LrcWidget(QWidget *parent = nullptr);
    ~LrcWidget();
    void updateCurUrl(const QUrl& url);
    void updateCurDuration(qint64 duration);
private:
    int getIndexOf(qint64 duration);
    QString getText(int index);
private:
    QUrl _currentUrl;
    QVector<LineOfLrc> _lyric;
    QNetworkAccessManager* _manager;
    Ui::LrcWidget *ui;
};

#endif // LRCWIDGET_H
